<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>slot用法</title>
</head>

<body>
    <div id="app">
        <child-component></child-component>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
    <script>
        Vue.component('child-component', {
            template: `
                <div>
                    <slot>
                        <p>如果父组件没有插入内容，我将作为默认出现</p>
                    </slot>
                </div>
            `
        });

        var app = new Vue({
            el: "#app",
            data: {
                showChild: true,
                app:'这里有一个文本'
            }
        })
    </script>
</body>

</html>